<!DOCTYPE html>
<html>
<head>
<title>Les promotions</title>
<?php
$numClient = $_GET ["numClient"];
echo '<meta charset="utf-8" HTTP-EQUIV="Refresh"';
echo '	CONTENT="888; URL=http://fr-d134685.groupinfra.com/showroom/iBeacon_project/iBeacon_project/web/vendeur_page_promo.php?numClient=' . $numClient . '">';
?>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- My style -->
<link href="../css/bootstrap.css" rel="stylesheet" media="screen">
<link href="../css/dashboard.css" rel="stylesheet">
<link href="../css/ecran-marketing.css" rel="stylesheet">
</head>
<body>

	<div class="container">
		<article>

			<div class="navbar navbar-default navbar-fixed-top" role="navigation">
				<div class="container">
					<div class="navbar-header">
						<a href="./vendeur_choix_service.php"> <img class="pull-left"
							src="../img/logo.png" width="125px" height="50px">
						</a>
						<button type="button" class="navbar-toggle" data-toggle="collapse"
							data-target=".navbar-collapse">
							<span class="sr-only">Toggle navigation</span> <span
								class="icon-bar"></span> <span class="icon-bar"></span> <span
								class="icon-bar"></span>
						</button>
						<a class="navbar-brand" href="#"><?php include './affichage_user.php'; ?></a>
					</div>
					<div class="collapse navbar-collapse">
						<ul class="nav navbar-nav">
							<li class="active"><a href="#duree" data-toggle="pill">Promotions
									TOP 10</a></li>
							<li class="dropdown"><a href="#" class="dropdown-toggle"
								data-toggle="dropdown">Categories <b class="caret"></b></a>
								<ul class="dropdown-menu">
								
							<?php
							require_once ("../services/ResponsableService.php");
							
							$responsableService = new ResponsableService ();
							
							$_SESSION ['listTypeArticle'] = $responsableService->getListTypeArticle ();
							
							$listTypeArticle = $_SESSION ['listTypeArticle'];
							foreach ( $listTypeArticle as $typeArticle ) {
								echo '				<li><a href="#' . $typeArticle->getLibelleTypeArticle () . '">' . $typeArticle->getLibelleTypeArticle () . '</a></li>';
								echo '				<li class="divider"></li>';
							}
							?>
								</ul></li>
						</ul>
						<ul class="nav navbar-nav navbar-right">
							<li>
								<form name="zeform1" id="bouton"
									action="../action/deconnexionAction.php" method="post">
									<input id="deconnexion" name="deconnexion" type="hidden"
										value="Deconnexion" />
								</form> <a href="#nowhere" onClick="zeform1.submit();">Déconnexion</a>
							</li>
						</ul>
					</div>
				</div>
			</div>

			<br /> <br /> <br />

			<div class="col-sm-9 col-md-9">
				<div>
					<h1 class="page-header">Promotions</h1>
				</div>

						<?php
						// AFFICHE LA LISTE DES ARTICLES PROMOS DU MOMENT
						require_once ("../services/ResponsableService.php");
						
						$responsableService = new ResponsableService ();
						
						$_SESSION ['listArticlePromo'] = $responsableService->getListPromoDuMoment ();
						$id_client = $_GET ["numClient"];
						
						$listArticle = $_SESSION ['listArticlePromo'];
						
						foreach ( $listArticle as $promotion ) {
							echo '<div class="col-lg-3 col-md-2 col-xs-4 column productbox"';
							echo '			style="background-color: #F1F1F1;">';
							echo '			<a class="thumbnail" href="#"> <img class="img-responsive"';
							echo '				src="../img/' . $promotion->getNumArticle () . '.jpg" onclick="actionImageClick()"></a>';
							echo '			<div class="producttitle">' . $promotion->getLibelle () . '</div>';
							echo '			<div class="productprice" style="text-align: center">';
							echo '				<div class="pricetext">';
							echo '					<strike style="color: #B40404;">' . $promotion->getPrixUnitaire () . '€</strike>';
							echo '				</div>';
							echo '			</div>';
							echo '			<div class="productprice" style="text-align: center">';
							$res = $promotion->getPrixUnitaire () - $promotion->getPrixUnitaire () * $promotion->getPourcentagePromo () / 100;
							echo '				<div class="pricetext" style="color: #088A4B">' . number_format ( $res, 2 ) . '€</div>';
							echo '				<div class="pull-right">';
							echo '						<a class="btn btn-info btn-sm" href="../action/selectionnerPromoPourClientAction.php?numPromo=' . $promotion->getNumPromo () . '&numClient=' . $id_client . '">Selectionner</a> ';
							echo '				</div>';
							echo '			</div>';
							echo '		</div>';
						}
						?>
			</div>
		</article>

		<aside>
			<br> <br> <br> <br> <br>

			<div class="col-sm-3 col-md-3">
				<div class="panel-group" id="accordion">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h4 class="panel-title">
								<a data-toggle="collapse" data-parent="#accordion"
									href="#collapseOne"><span
									class="glyphicon glyphicon-folder-close"> </span>Historique</a>
							</h4>
						</div>
						<?php
						
						require_once ("../services/ResponsableService.php");
						
						$responsableService = new ResponsableService ();
						
						$_SESSION ['historique'] = $responsableService->getHistorique ();
						
						$listPromoClient = $_SESSION ['historique'];
						
						foreach ( $listPromoClient as $historique ) {
							
							echo '<div class="list-group">';
							echo '<a href="#" class="list-group-item">';
							echo '<h4 class="list-group-item-heading">Le client ' . $historique->getnomClient () . '</h4>';
							echo '<p class="list-group-item-text"> a recu la ' . $historique->getLibelle () . '</p>';
							echo '</a>';
							echo '</div>';
						}
						?>
					</div>
				</div>
			</div>

		</aside>


	</div>


</body>
<footer>
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>
	<script type="text/javascript">
		function actionImageClick() {
			alert("Promotion envoyée au client");
		}
	</script>
</footer>
</html>